export async function getData(chartType: 'heatmap' | 'waterfall', delay: number = 100): Promise<any[]> {
    return new Promise(resolve => setTimeout(() => resolve(generateData(chartType)), delay));
}

function generateData(chartType: 'heatmap' | 'waterfall'): any[] {
    switch (chartType) {
        case 'heatmap': return generateHeatmapData();
        case 'waterfall': return generateWaterfallData();
    }
}

function generateHeatmapData(): any[] {
    // Source: http://www.sheffieldweather.co.uk/Averages/MONTHLYAIRAVERAGE.htm
    return [
        { year: '2010', jan: 1.2, feb: 1.9, mar: 5.9, apr: 9.1, may: 10.9, jun: 15.2, jul: 16.2, aug: 14.9, sep: 13.4, oct: 9.5, nov: 4.9, dec: 0.4, },
        { year: '2011', jan: 3.9, feb: 6, mar: 6.6, apr: 12, may: 12, jun: 14.2, jul: 15.8, aug: 15.8, sep: 14.9, oct: 12.2, nov: 8.9, dec: 5.4, },
        { year: '2012', jan: 5.1, feb: 4.5, mar: 8.6, apr: 6.7, may: 11.6, jun: 13.4, jul: 15.5, aug: 16.2, sep: 12.7, oct: 8.8, nov: 6.1, dec: 4.2, },
        { year: '2013', jan: 3.4, feb: 2.7, mar: 1.7, apr: 7.4, may: 10.6, jun: 14.1, jul: 18.4, aug: 16.8, sep: 13.3, oct: 11.7, nov: 6.2, dec: 6.3, },
        { year: '2014', jan: 5, feb: 5.6, mar: 7.4, apr: 10.1, may: 12.2, jun: 15.3, jul: 17.9, aug: 14.9, sep: 14.4, oct: 11.4, nov: 7.8, dec: 5.2, },
        { year: '2015', jan: 4.1, feb: 3.8, mar: 5.9, apr: 9.1, may: 10.6, jun: 13.9, jul: 15.7, aug: 15.8, sep: 12.2, oct: 10.2, nov: 8.7, dec: 8.6, },
        { year: '2016', jan: 4.8, feb: 4.2, mar: 5.5, apr: 7, may: 11.8, jun: 14.6, jul: 16.6, aug: 16.6, sep: 15.4, oct: 10.2, nov: 5.4, dec: 6.3, },
        { year: '2017', jan: 3.9, feb: 5.2, mar: 8, apr: 8.6, may: 12.8, jun: 15.7, jul: 16.4, aug: 15.2, sep: 13, oct: 11.9, nov: 6.5, dec: 4.7, },
        { year: '2018', jan: 4.4, feb: 2.3, mar: 3.7, apr: 8.8, may: 13.8, jun: 16.4, jul: 19.5, aug: 17, sep: 13.4, oct: 10.3, nov: 7.4, dec: 6.4, },
        { year: '2019', jan: 4.4, feb: 6.9, mar: 7.5, apr: 8.9, may: 11.5, jun: 14.1, jul: 17.8, aug: 17.1, sep: 13.7, oct: 9.2, nov: 5.4, dec: 5.4, },
        { year: '2020', jan: 6.4, feb: 5.6, mar: 6.3, apr: 10.3, may: 12.8, jun: 15, jul: 15.6, aug: 17.2, sep: 13.7, oct: 9.8, nov: 8.1, dec: 4.6, },
        { year: '2021', jan: 2.8, feb: 4.3, mar: 7.2, apr: 6.5, may: 10, jun: 16.1, jul: 18.4, aug: 16.1, sep: 16.2, oct: 11.6, nov: 7.7, dec: 5.4, },
        { year: '2022', jan: 5.2, feb: 6.1, mar: 7.4, apr: 9.2, may: 13.3, jun: 15.5, jul: 18.5, aug: 18.4, sep: 14.5, oct: 12.1, nov: 8.4, dec: 3.6, },
    ];
}

function generateWaterfallData(): any[] {
    return [
        { financials: 'Income\nTax', amount: 185 },
        { financials: 'VAT', amount: 145 },
        { financials: 'NI', amount: 134 },
        { financials: 'Corp\nTax', amount: 55 },
        { financials: 'Council\nTax', amount: 34 },
        { financials: 'Social\nProtection', amount: -252 },
        { financials: 'Health', amount: -155 },
        { financials: 'Education', amount: -112 },
        { financials: 'Defence', amount: -65 },
        { financials: 'Debt\nInterest', amount: -63 },
        { financials: 'Housing', amount: -31 },
    ];
}